package design_pattern

import "fmt"

//https://learnku.com/articles/33707

type seller interface {
	sell(name string)
}
type Station struct {
	stock int
}

func (s *Station) sell(name string) {
	if s.stock > 0 {
		s.stock--
		fmt.Printf("%s 买了一张票，剩余：%d", name, s.stock)
	} else {
		fmt.Println("已经没票了")
	}
}

type StationProxy struct {
	station *Station
}

func (s *StationProxy) sell(name string) {
	s.station.sell(fmt.Sprintf("搭理销售：%s",name))
}
